@echo off
chcp 65001 >nul
echo 开始编译32位DLL...

REM 清理旧的构建目录
if exist cmake-build-debug rmdir /s /q cmake-build-debug

REM 创建output目录
if not exist output mkdir output

REM 设置编译器路径
set CMAKE_PATH="E:\soft\JetBrains\CLion 2025.1.4\bin\cmake\win\x64\bin\cmake.exe"
set NINJA_PATH="E:\soft\JetBrains\CLion 2025.1.4\bin\ninja\win\x64\ninja.exe"

REM 配置CMake项目
echo 配置CMake项目...
%CMAKE_PATH% -S . -B cmake-build-debug -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=%NINJA_PATH%

if %ERRORLEVEL% neq 0 (
    echo CMake配置失败！
    pause
    exit /b 1
)

REM 编译项目
echo 编译项目...
%CMAKE_PATH% --build cmake-build-debug --target all

if %ERRORLEVEL% neq 0 (
    echo 编译失败！
    pause
    exit /b 1
)

echo.
echo 编译完成！32位DLL已输出到output文件夹
echo.
dir output
echo.
echo 测试DLL...
output\test_program.exe

pause 